package com.xzl.org.learning_situation_analysis.service.Impl;

import com.github.pagehelper.PageInfo;
import com.xzl.org.learning_situation_analysis.dao.ClazzMapper;
import com.xzl.org.learning_situation_analysis.entity.Clazz;
import com.xzl.org.learning_situation_analysis.service.ClazzService;
import com.xzl.org.learning_situation_analysis.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 夏智力
 * @FileName ClazzServiceImpl
 * @date 2022/4/21 11:14
 * @Software: IntelliJ IDEA
 */
@Service
public class ClazzServiceImpl implements ClazzService {

    @Autowired
    private ClazzMapper clazzMapper;

    @Override
    public int insertClazz(Clazz clazz) {
        return clazzMapper.insertClazz(clazz);
    }

    @Override
    public int delClazz(int id) {
        return clazzMapper.delClazz(id);
    }

    @Override
    public PageInfo<Clazz> selectCurrentPageClazz(int currentPage, int pageSize) {
        List<Clazz> clazzAll = clazzMapper.selectAll();
        PageInfo page = new PageUtil<Clazz>().getPage(currentPage,pageSize,clazzAll);
        return page;
    }
}
